public class dog {
    private String name;
    private int age;

    public dog(String name,int age){
        this.name=name;
        this.age=age;
    }

    @Override
    public int hashCode() {
        return name.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if(this==obj)
        {
            return true;
        }
        if(!(obj instanceof dog))
        {
            return false;
        }
        dog a=(dog)obj;
        return this.name.equals(a.name)&&this.age==a.age;
    }

    @Override
    public String toString() {
        return "dog{"+
                "name='"+name+'\''+
                ",age="+age+
                '}';
    }

}
